﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Waker.Common
{
    public class CrossThread
    {
        Action<object> _Action;
        Form _Form;
        public CrossThread(Form f, Action<object> action)
        {
            _Action = action;
            _Form = f;
            //if (action != null)
            //    _Form.Invoke(action);
        }
        public void CrossThreadInvoke(object obj)
        {
            if (_Action != null)
                _Form.Invoke(_Action, obj);
        }
        public void CrossThreadInvoke()
        {
            if (_Action != null)
                _Form.Invoke(_Action, 1);
        }
    }
}
